Don't spawn threads for fresh work
authorAlex Crichton <alex@alexcrichton.com>
Fri, 2 Jun 2017 16:15:11 +0000 (09:15 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 5 Jun 2017 14:36:44 +0000 (07:36 -0700)
On "fresh" builds this ends up just wasting a lot of time!

src/cargo/ops/cargo_rustc/job_queue.rs

index 7bb3e35e12673b87857a896a95ea75d294415317..fa008289ddaeb7c86239dcc5641aaf509f161c62 100644 (file)
@@ -294,12 +294,16 @@ impl<'a> JobQueue<'a> {
         *self.counts.get_mut(key.pkg).unwrap() -= 1;
 
         let my_tx = self.tx.clone();
-        scope.spawn(move || {
+        let doit = move || {
             let res = job.run(fresh, &JobState {
                 tx: my_tx.clone(),
             });
             my_tx.send(Message::Finish(key, res)).unwrap();
-        });
+        };
+        match fresh {
+            Freshness::Fresh => doit(),
+            Freshness::Dirty => { scope.spawn(doit); }
+        }
 
         // Print out some nice progress information
         self.note_working_on(config, &key, fresh)?;